package com.qf.day07.poly.tuxing;

/**
 * 圆形
 * 子类
 */
public class Circle extends TuXing{
    //圆的半径
    private double r;

    public Circle() {
    }

    public Circle(String name) {
        super(name);
    }

    public Circle(double r) {
        this.r = r;
    }

    public Circle(String name, double r) {
        super(name);
        this.r = r;
    }

    public double getR() {
        return r;
    }

    public void setR(double r) {
        this.r = r;
    }

    @Override
    public double zc() {
        //调用父类的周长
         super.zc();
         //2πR
        double pai = 3.14;
        double v = 2 * pai * r;
        System.out.println(getName()+"周长为"+v);
        return v;
    }
    public void area(){
        super.area();
        double pai = 3.14;
        double area = pai*r*r;
        System.out.println(getName()+"面积为:"+area);
    }
}
